package com.yingsheng.bi.hks.basic.exception;

import java.util.HashMap;
import java.util.Map;

public class ElementException extends RuntimeException {

    private Object[] args;

    private Map<String, Object> datas;

    public ElementException(String message) {
        super(message);
    }

    public ElementException(String message, Object[] args) {
        this(message);
        this.args = args;
    }

    public ElementException(String message, Throwable cause) {
        super(message, cause);
    }

    public Object[] getArgs() {
        return args;
    }

    public void setArgs(Object[] args) {
        this.args = args;
    }

    public Map<String, Object> getDatas() {
        if (this.datas == null) {
            this.datas = new HashMap<>();
        }
        return datas;
    }

    public void setDatas(Map<String, Object> datas) {
        this.datas = datas;
    }

    public void setData(String key, Object value) {
        Map<String, Object> datas = getDatas();
        datas.put(key, value);
    }

    public Object setData(String key) {
        Map<String, Object> datas = getDatas();
        return datas.get(key);
    }


}
